package com.sky.sqlSession;

import com.sky.config.XMLConfigBuilder;
import com.sky.pojo.Configuration;
import org.dom4j.DocumentException;

import java.io.InputStream;

/**
 * @Description 1.解析配置文件，封装Configuration 2.创建SqlSessionFactory工厂对象
 * @Author gaotianzhi
 * @Date 2023-10-31 16:12
 */
public class SqlSessionFactoryBuilder {


    public SqlSessionFactory build(InputStream inputStream) throws DocumentException {
        XMLConfigBuilder xmlConfigBuilder = new XMLConfigBuilder();

        Configuration configuration = xmlConfigBuilder.parse(inputStream);

        return new DefaultSqlSessionFactory(configuration);

    }
}
